import 'package:XinXiZiXun/common/entitys/entitys.dart';
import 'package:XinXiZiXun/common/utils/utils.dart';
import 'package:XinXiZiXun/common/values/constants.dart';
import 'package:XinXiZiXun/common/values/values.dart';
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';

///轮播图
Widget handleBanner(BuildContext context, List<BannerEntity> bannerElements) {
  return ClipRRect(
    borderRadius: Radii.k10pxRadius,
    child: Container(
      width: double.infinity,
      height: duSetHeight(4 * ksDefaultPadding),
      color: AppColors.primaryWhiteColor,
      child: Swiper(
        itemBuilder: (BuildContext context, int index) {
          return Image.network(
            bannerElements[index].imagePath,
            fit: BoxFit.fill,
          );
        },
        itemCount: (bannerElements != null ? bannerElements.length : 0),
        autoplay: false,
        scrollDirection: Axis.horizontal,
        // pagination: SwiperPagination(
        //   alignment: Alignment.bottomCenter,
        // ),
        // control: SwiperControl(),
      ),
    ),
  );
}
